/**
 * 
 */
package com.huawei.struts.service.imp;

import java.util.List;

import com.huawei.struts.dao.LjwRoleTDAO;
import com.huawei.struts.exception.SystemException;
import com.huawei.struts.service.IRoleService;
import com.huawei.struts.util.PageBean;
import com.st.model.LjwRoleT;

/**
 * @author Administrator
 *
 */
public class RoleService implements IRoleService {
	
	private LjwRoleTDAO lwjRoleDao;
	

	public void setLwjRoleDao(LjwRoleTDAO lwjRoleDao) {
		this.lwjRoleDao = lwjRoleDao;
	}

	/* (non-Javadoc)
	 * @see com.huawei.struts.service.IRoleService#addRole(com.st.model.LjwRoleT)
	 */
	public void addRole(LjwRoleT role) throws SystemException {
		try {
			lwjRoleDao.save(role);
		} catch (Exception e) {
			throw new SystemException("error.info", e.getCause());
		}
		

	}

	/* (non-Javadoc)
	 * @see com.huawei.struts.service.IRoleService#delRole(com.st.model.LjwRoleT)
	 */
	public void delRole(LjwRoleT role) throws SystemException {
		try{
			lwjRoleDao.delete(role);
		} catch (Exception e) {
			throw new SystemException("error.info", e.getCause());
		}

	}

	/* (non-Javadoc)
	 * @see com.huawei.struts.service.IRoleService#getRoleInfoByid(java.lang.Integer)
	 */
	public LjwRoleT getRoleInfoByid(Integer id) throws SystemException {
		// TODO Auto-generated method stub
		return lwjRoleDao.findById(id);
	}

	/* (non-Javadoc)
	 * @see com.huawei.struts.service.IRoleService#getRoleList(com.st.model.LjwRoleT, com.huawei.struts.util.PageBean)
	 */
	public PageBean getRoleList(LjwRoleT role, PageBean pageBean) {
		List list=lwjRoleDao.findAll();
		pageBean.setList(list);
		return pageBean;
	}

	/* (non-Javadoc)
	 * @see com.huawei.struts.service.IRoleService#modifyRole(com.st.model.LjwRoleT)
	 */
	public void modifyRole(LjwRoleT role) throws SystemException {
		try{
			lwjRoleDao.merge(role);
		} catch (Exception e) {
			throw new SystemException("error.info", e.getCause());
		}

	}

}
